<?php 
namespace app\index\controller;
use think\Controller;

/**
* 
*/
class Power extends Controller
{
	// 普通ordinary  变为普通帖子
	public function ord($id)
	{
		$cateid = db('note')->where('id',$id)->find()['cateid'];
		db('note')->where('id',$id)->update(['type'=>0]);
		return $this->success('修改成功',url('notelist/index',array('id'=>$cateid)));
		
	}
	// 精华Essence  变为精华帖子
	public function ess($id)
	{
		$cateid = db('note')->where('id',$id)->find()['cateid'];
		db('note')->where('id',$id)->update(['type'=>1]);
		return $this->success('修改成功',url('notelist/index',array('id'=>$cateid)));
		
	}
	// 封帖seal  
	public function seal($id)
	{
		$cateid = db('note')->where('id',$id)->find()['cateid'];
		db('note')->where('id',$id)->update(['status'=>1]);
		return $this->success('修改成功',url('notelist/index',array('id'=>$cateid)));
		
	}
	// 解帖 solution  
	public function solu($id)
	{
		$cateid = db('note')->where('id',$id)->find()['cateid'];
		db('note')->where('id',$id)->update(['status'=>0]);
		return $this->success('修改成功',url('user/control',array('id'=>session('user')['id'])));
		
	}
}